define(['WebPDF'], function (WebPDF) {
	'use strict';
	WebPDF.directive('leftpanel', [function () {
		return {
			restrict: 'AE',			
			replace: true,
			templateUrl: 'js/pdfview/tpl/leftpanel.html',					
			controller: function($scope) {					   
				this.triggerPanel = $scope.triggerPanel;					
			},
			link: function ($scope, element, iAttrs) {		
				$scope.leftPanelWidth =  7;
				$scope.isExpanded = false;		
				$scope.triggerPanel = function() {
					$scope.$apply(function() {						
						$scope.isExpanded = !$scope.isExpanded;
					});
				};	
				
				$scope.$watch("isExpanded", function(newValue) {						
					if (newValue){
						$scope.leftPanelWidth = 223;
					}
					else{
						$scope.leftPanelWidth = 5;
					}
				});

				element.on('click','#docViewer_leftLine', function () {						
					$scope.triggerPanel();			
				});
			}
		};
	}]);
});